<template v-slot:tabbar>
  <div id="main_bar">
    <div>
        <div v-if="!isActive"><slot name="icon"></slot></div>
        <div v-else><slot name="icon_active"></slot></div>
        <div :style="activeColor"><slot name="text"></slot></div>
    </div>
    <!-- <div>
      <img src="" alt="1" />
      <img src="" alt="1" />
      <p>首页</p>
    </div>
    <div>
      <img src="" alt="1" />
      <img src="" alt="1" />
      <p>首页</p>
    </div>
    <div>
      <img src="" alt="1" />
      <img src="" alt="1" />
      <p>首页</p>
    </div> -->
  </div>
</template>

<script>
export default {
  props: {
    path: String,
    activeColor: {
      type: String,
      default: "#FF5777"
    }
  },
  computed: {
    isActive() {
      return this.$route.path.indexOf(this.path) !== -1;
    },
    activeStyle() {
      return this.isActive ? { color: this.activeColor } : {};
    }
  },
  methods: {
    itemClick() {
      this.$router.push(this.path);
    }
  }
};
</script>

<style>
#main_bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* padding: 5px; */
}
#main_bar > div {
  margin: 0 10px;
}
img{
  width: 20px;
  height: 20px;
  margin-top: 5px;
}
#main_bar > div p {
  margin: 0;
}
</style>